package com.sunday.demo.lod.factory;

import com.sunday.demo.lod.entity.Html;
import com.sunday.demo.lod.handler.Document;
import com.sunday.demo.lod.handler.HtmlDownLoader;

/**
  @program: design-patterns
  @author: Jh
  @create: 2021-09-01 10:17
*/
public class DocumentFactory {

    private HtmlDownLoader htmlDownLoader;

    public DocumentFactory(HtmlDownLoader htmlDownLoader) {
        this.htmlDownLoader = htmlDownLoader;
    }

    public Document create(String url) {
        Html html = htmlDownLoader.download(url);
        return new Document(url,html);
    }
}
